home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / comm / cnet / viewlog.lha / viewlog5 / VL_UserLog < prev   
Text File  |  1996-11-03  |  10KB  |  197 lines

  1. /**************************************************************************\
  2.             $VER: User View Log, v5.01 (3-Nov-96) by Dotoran!
  3. \**************************************************************************/
  4. options results ; signal on SYNTAX ; signal on ERROR ; signal on IOERR
  5. tr=transmit ; se=sendstring ; gc=getchar ; gu=getuser ; mg=maygetchar
  6. a='rexxsupport.library';if ~show('l',a) then if ~addlib(a,0,-30) then exit
  7.  
  8. ver="5.01" ; changewhere "UserViewLog"ver
  9. tr "f1n3cfWelcome c6to cbView Logc6, c7vcf"ver"c6!"
  10. se "n1caInitializingc6...c9" ; tw=0 ; call READCONFIG ; call CHECKVER
  11. call CHECKTERM ; call READTITLES ; call READDATA
  12.  
  13. lo=1 ; hi=45 ; if hi>logs then hi=logs
  14. if ascii=1 then signal VIEWASC
  15.  
  16. BEGIN: ; row=1 ; col=1 ; cols="12 32 52" ; r=1
  17.   tr "f1@4 ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÄView Logv"ver" by Dotoran of Frontiers BBS <ÄÍÍÍÍÍÍÍÍÍÍÍÍÍ»"
  18.   tr " ÈÍÍ» ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ÉÍͼ"
  19.   tr " ÉÍͼ ÛÛßCßÛÛ ÈÍÍ»" ; tr " ÈÍÍ» ÛÛCÛÛ ÉÍͼ"
  20.   tr " ÉÍͼ ÛÛCÛÛ ÈÍÍ»" ; tr " ÈÍÍ» ÛÛCÛÛ ÉÍͼ"
  21.   tr " ÉÍͼ ÛÛCÛÛ ÈÍÍ»" ; tr " ÈÍÍ» ÛÛCÛÛ ÉÍͼ"
  22.   tr " ÉÍͼ ÛÛCÛÛ ÈÍÍ»" ; tr " ÈÍÍ» ÛÛCÛÛ ÉÍͼ"
  23.   tr " ÉÍͼ ÛÛCÛÛ ÈÍÍ»" ; tr " ÈÍÍ» ÛÛCÛÛ ÉÍͼ"
  24.   tr " ÉÍͼ ÛÛCÛÛ ÈÍÍ»" ; tr " ÈÍÍ» ÛÛCÛÛ ÉÍͼ"
  25.   tr " ÉÍͼ ÛÛCÛÛ ÈÍÍ»" ; tr " ÈÍÍ» ÛÛCÛÛ ÉÍͼ"
  26.   tr " ÉÍͼ ÛÛCÛÛ ÈÍÍ»" ; tr " ÈÍÍ» ÛÛCÛÛ ÉÍͼ"
  27.   tr " ÉÍͼ ÛÛÜCÜÛÛ ÈÍÍ»" ; tr " ÈÍÍ» ÛÛÛÛÛÛ               ÛÛÛÛÛ<R>ead ALL LogsÛÛÛÛÛ              ÛÛÛÛÛÛÛ ÉÍͼ" ; tr " ÉÍͼCÈÍÍ»"
  28.   tr " ÈÍÍÍÍÄUse Arrow Keys to Move<ENTERto View<ESCor <Qto Quit <ÄÍÍÍͼ"
  29.  
  30. VIEWANS:
  31.   do i=lo to hi by 3 ; i2=i+1 ; i3=i+2
  32.     c="c7" ; if r/2=r%2 then c="cf"
  33.     se ""r+3";12H"c||center(logN.i,17)
  34.     se ""r+3";32H"c||center(logN.i2,17)
  35.     se ""r+3";52H"c||center(logN.i3,17)
  36.     r=r+1
  37.   end i
  38.   if lo>1&hi<90 then do ; do i=hi to 90 by 3
  39.     tr ""r+3";13H"copies(" ",55) ; r=r+1 ; end i ; end
  40.   se "9Hz4cf<caLog Names ceenclosed in cb*'s cdexist cepresentlycf>z0"
  41.   if hi<logs then do
  42.     se "13Hz4             53Hcf<cbNcf>cbext Screenz0";end
  43.   if lo>1 then do
  44.     se "13Hz4cf<cbPcf>cbast Screen53H             z0";end
  45. VIEWANS2: ; z=LOC() ; ex=" ";if exF.z=1 then ex="*"
  46.   tr ""row+3";"word(cols,col)"Hz5ce"ex||center(logN.z,15)ex"z0"
  47.   se "9H";gc;call CHECK;k=result;kk="";if k=d2c(27) then do;do 2;mg;kk=result;end;end
  48.   if (kk~="NOCHAR" & kk>"") | index("2468",k)>0 then do ; c="c7" ; if row/2=row%2 then c="cf"
  49.     tr ""row+3";"word(cols,col)"H"c||center(logN.z,17);oldz=z
  50.     if k=8 | kk="A" then do ; row=row-1 ; if row<1 then do ; row=16
  51.       do until logN.z>"" ; row=row-1 ; z=LOC() ; end ; end
  52.       signal VIEWANS2;end
  53.     if k=2 | kk="B" then do ; row=row+1 ; z=LOC()
  54.       if logN.z="" | row>15 then row=1
  55.       signal VIEWANS2;end
  56.     if k=6 | kk="C" then do ; col=col+1 ; z=LOC()
  57.       if logN.z="" | col>3 then col=1
  58.       signal VIEWANS2;end
  59.     if k=4 | kk="D" then do ; col=col-1 ; if col<1 then do ; col=4
  60.       do until logN.z>"" ; col=col-1 ; z=LOC() ; end ; end
  61.       signal VIEWANS2;end ; end
  62.   if c2d(k)=13 & exF.z=1 then do ; a=logI.z
  63.     if ar=1 then do ; call setclip("ARt",title.a) ; call setclip("ARi",a)
  64.       se "Hz4#0"ARpt" sysdata:log/"logF.z",4,e,b,9,5,e,1,0}"
  65.       call setclip("ARt") ; call setclip("ARi") ; end
  66.     else do ; tr "f1c6Now cbViewing c6the cf`ca"logN.z"cf' c6logc9:"
  67.       if title.a>"" then tr "n1z5ce"left(title.a,79)"z0"
  68.       tr "*0SysData:Log/"logF.z"}"
  69.       se "c7<c6Press cdANY KEY c6Nowc7>g1" ; end
  70.     signal BEGIN ; end
  71.  
  72.   if k="R" then do
  73.     do i=1 to logs ; if exF.i=0 then iterate i ; else a=logI.i
  74.       if ar=1 then do ; call setclip("ARt",title.a) ; call setclip("ARi",a) ; call setclip("ARa","1")
  75.         se "Hz4#0"ARpt" sysdata:log/"logF.i",4,e,b,9,5,e,1,0}"
  76.         call setclip("ARt") ; call setclip("ARi") ; call setclip("ARa") ; end
  77.       else do ; tr "f1c6Now cbViewing c6the cf`ca"logN.i"cf' c6logc9:"
  78.         if title.a>"" then tr "n1z5ce"left(title.a,79)"z0"
  79.         tr "*0SysData:Log/"logF.i"}" ; end
  80.       se "2Hz4cePress <Q>uit, or ANY OTHER KEY for next log...z0"
  81.       gc;a=result;if a="Q" then leave i ; else tr "Hz4z0"
  82.     end i ; signal BEGIN ; end
  83.   if k="N"&hi<logs then do;r=1;row=1;col=1
  84.     lo=lo+45;hi=hi+45;if hi>logs then hi=logs;signal VIEWANS;end
  85.   if k="P"&lo>1 then do;r=1;row=1;col=1
  86.     lo=lo-45;hi=lo+44;signal VIEWANS;end
  87.   if k="Q"|kk="NOCHAR" then do;se "28HcbThanks c6for using caView Log c6today!"
  88.     exit;end
  89.  signal VIEWANS2
  90.  
  91. LOC: ; return (row*3+col-3)+(45*(lo>1))
  92.  
  93. READCONFIG:;gu 1311992;comP=result
  94.   call open(f1,comP"ViewLog5.cfg","r")
  95.     vers=readln(f1) ; macc=readln(f1)
  96.     uacc=readln(f1) ; trim=readln(f1) ; trln=readln(f1)
  97.     logH=readln(f1) ; hisP=readln(f1) ; hisT=readln(f1)
  98.     ETex=readln(f1)
  99.     AR=readln(f1);ARsy=readln(f1);ARpt=readln(f1)
  100.   call close(f1)
  101.  return
  102.  
  103. CHECKVER: ; if ver=vers then return
  104.   tr "f1n6c9Version Conflict:n1"
  105.   tr "   `ViewLog5.cfg' version: v"vers
  106.   tr "     `VL_UserLog' version: v"ver
  107.   tr "n1   BOTH files above need to be v"max(ver,vers)"!"
  108.   tr "n1   Please inform your SysOp of this..."
  109.   tr "n1Halting, due to conflicting versions..."
  110.  exit
  111.  
  112. READDATA: ; gu 15 ; ac=result ; acF.=0 ; exF.=0
  113.   if ~exists(comP"VL_Data") then do
  114.     se "n1c9I'm sorry, but the SysOp hasn't completely configured ViewLog "
  115.     tr "yet.  Please leave feedback telling them this. Thanks!";exit;end
  116.   se "n1cbReading c6Logsc9: cd000h3"
  117.   call open(f1,comP"VL_Data","r") ; logN.="" ; logs=0
  118.     do i=1 until eof(f1) ; log.i=readln(f1) ; se "cd"right("cb"logs,6,"0")"<3"
  119.       parse var log.i 1 logI . 5 logN . 20 logF . 35 j . 50 uac"  " .
  120.       if index(uac,ac)>0 then do ; logs=logs+1 ; logI.logs=logI
  121.         logN.logs=logN ; logF.logs=logF
  122.         exF.logs=exists("SysData:Log/"logF.logs) ; end
  123.     end i
  124.   call close(f1)
  125.  return
  126.  
  127. READTITLES:
  128.   call open(f1,comP"VL_Titles","r") ; title.=""
  129.     do i=1 until eof(f1) ; a=readln(f1) ; if ascii=0 then se TWIRL()
  130.       parse var a 1 v1 . 5 v2 . 17 v3 ; title.v1=v3 ; end i ; titles=i-1
  131.   call close(f1) ; tr "cdDonec6!"
  132.  return
  133.  
  134. TWIRL:;sh="--\\||//";tw=tw+1;if tw>8 then tw=1;return substr(sh,tw,1)"<1"
  135.  
  136. CHECKTERM: ; gu 27 ; lw=result ; if lw<80 then do
  137.   se "n2   I'm sorry, but you need to be using an 80 column terminal program "
  138.   se "in order to use this command. If you ARE using an 80 column terminal, then "
  139.   se "please check your Screen Width setting using the `"ETex"' command from any "
  140.   se "command prompt. Thank You.";exit;end
  141.   gu 28 ; term=result ; ascii=0 ; if term<2 | term=3 then do
  142.   se "n2    I notice that you are not set to use IBM-ANSI terminal emulation. "
  143.   se "Although it will still be possible for you to view logs created on this "
  144.   se "bbs when you are NOT in this mode, you'll be missing out on a lot of neat "
  145.   se "features and colors.n2   If you called using ANSI mode enabled in your terminal "
  146.   se "program, then you'll need to enable the ANSI parameters in your account "
  147.   se "on this bbs. You can do this by using the `"ETex"' command from any prompt."
  148.   se "n2Do you wish to view the logs in Ascii Mode now? [No]: "
  149.   gc;a=result;if a~="Y" then do;tr "No.";exit;end
  150.   else do;se "Yes!";ascii=1;end;end
  151.  return
  152.  
  153. VIEWASC:;c=1;lo=1;hi=45;if hi>logs then hi=logs
  154. VIEWASC2:;tr "f1c7Ascii View Log, v"ver" by Dotoran of Frontiers!     <*>=This Log Existsn1"
  155.   do i=lo to hi;se right(i,2)": <"substr(" *",exF.i+1,1)"> "left(logN.i,15)
  156.   c=c+1;if c=4 then do;tr;c=1;end;end i;se "n1";v1="";v2=""
  157.   if hi<logs then do;v1="N/";se "<N>ext 45 Logs, ";end
  158.   if lo>1 then do;v2="P/";se "<P>ast 45 Logs, ";end
  159.   tr "<R>ead ALL Existing Logs, [<ENTER>/<Q>uit]"
  160.   se "n1Enter Command or Log Number to View? ["v1||v2"R/Q/1-"logs"]: i1 2}"
  161.   gu 70;a=result;if a="R" then signal VIEWASC3
  162.   if a="N"&hi<logs then do;lo=lo+45;hi=hi+45;if hi>logs then hi=logs
  163.     signal VIEWASC2;end
  164.   if a="P"&lo>1 then do;lo=lo-45;hi=lo+44;signal VIEWASC2;end
  165.   if a=""|a="Q" then exit
  166.   if exF.a=0 then do
  167.     se "n1This log does not exist presently. <Key>g1";signal VIEWASC2;end
  168.   if datatype(a,'n')=1 then do;z=logI.a
  169.     tr "f1Now viewing the `"logN.a"' log:"
  170.     if title.z>"" then tr "n1"title.z
  171.     tr "*0SysData:Log/"logF.a"}"
  172.     se "<Press ANY KEY Now>g1"
  173.     signal VIEWASC ; end
  174.  signal VIEWASC
  175.  
  176. VIEWASC3:
  177.   do i=1 to logs
  178.     if exF.i=0 then iterate
  179.     z=logI.i ; tr "f1Now viewing the `"logN.i"' log:"
  180.     if title.z>"" then tr "n1"title.z
  181.     tr "*0SysData:Log/"logF.i"}"
  182.     se "Press <Q>uit, or ANY OTHER KEY to continue...";gc;a=result
  183.     if a="Q" then signal VIEWASC
  184.   end i
  185.  signal VIEWASC
  186.  
  187. CHECK:;if result~="###PANIC" then return result
  188.   a="Lost Carrier!";tr "1Hc9"a;logentry a;exit
  189.  
  190. SYNTAX:;ERROR:;IOERR:;e1=' Error: 'rc' ('errortext(rc)')'
  191.   e2='  Line: 'left(sigl,4)'File:';gu 1311992;a=result;gu 1311960
  192.   b=result;c='"'a||b'"';e2=e2' 'c;tr e1;tr e2;logentry e1;logentry e2
  193.   e=sourceline(sigl);do while e~='';e3='Source: 'left(e,37);tr e3
  194.   logentry e3;e=substr(e,38);end;bufferflush;exit
  195. /**************************************************************************\
  196. \****************************************** Frontiers BBS (716)/823-9892 **/
  197.